import { lazy } from 'react';
import type { IRouter } from './router.d';
import Login from '@/views/login';

/** Routes 配置说明
 * {
 *  path: '', // 路由路径 同时也是唯一的KEY
 *  meta: {
 *    title: string, // 用于标题、menu、面包屑 （对照locales 语言包写对应的key）
 *    breadcrumb: boolean, // 是否显示面包屑（默认显示）
 *    activeMenu: string, // 当前需要高亮menu 的path
 *    adaption: boolean, // 默认true 是否自适应内容区域
 *  },
 *  autuKeys: string[], // router 权限的keys
 *  alwaysShow: boolean, // 是否一直展示子级 （默认不展示）  当children个数小于1时默认在menu默认不会展示父级菜单会直接展示子级
 *  hidden: boolean, // 是否在menu显示（默认显示）
 * }
*/

const routes: IRouter[] = [
  {
    meta: { title: '基础应用', icon: 'icon-jichuyingyong' },
    path: '/basic-app',
    name: 'basicApp',
    component: 'Layouts',
    children: [{
      meta: { title: '班级信息' },
      path: 'class-info',
      name: 'classInfo',
      component: lazy(() => import('@/views/BasicApp/ClassInfo'))
    }, {
      meta: { title: '教职工信息' },
      path: 'faculty-info',
      name: 'facultyInfo',
      component: lazy(() => import('@/views/BasicApp/FacultyInfo'))
    }, {
      meta: { title: '学生信息' },
      path: 'student-info',
      name: 'studentInfo',
      component: lazy(() => import('@/views/BasicApp/StudentInfo'))
    }]
  },
  {
    meta: { title: '校园安全', icon: 'icon-xiaoyuananquan' },
    path: '/campus-security',
    name: 'CampusSecurity',
    component: 'Layouts',
    children: [{
      meta: { title: '校园监控' },
      path: 'monitor',
      name: 'CampusSecurityMonitor',
      children: [{
        meta: { title: '校园监控', adaption: false, breadcrumb: false },
        path: 'list',
        name: 'CampusSecurityMonitorList',
        component: lazy(() => import('@/views/CampusSecurity/monitor'))
      }, {
        meta: { title: '监控大屏', activeMenu: '/campus-security/monitor/list', adaption: false, breadcrumb: false },
        path: 'detail',
        hidden: true,
        name: 'ampusSecurityMonitorDetail',
        component: lazy(() => import('@/views/CampusSecurity/MonitorDetail'))
      }]
    }]
  },
  {
    meta: { title: '在线教研', icon: 'icon-zaixianjiaoyan1' },
    path: '/online-research',
    name: 'OnlineResearch',
    component: 'Layouts',
    children: [{
      meta: { title: '在线直播' },
      path: 'live-broad',
      name: 'OnlineResearchLiveBroad',
      children: [{
        meta: { title: '在线直播', adaption: false, breadcrumb: false },
        path: 'list',
        name: 'OnlineResearchLiveBroadIndex',
        component: lazy(() => import('@/views/OnlineResearch/LiveBroad'))
      },
      {
        meta: { title: '直播间', activeMenu: '/online-research/live-broad/list', adaption: false },
        path: 'room',
        hidden: true,
        name: 'LiveBroadRoom',
        component: lazy(() => import('@/views/OnlineResearch/LiveBroadRoom'))
      }]
    }]
  },
  {
    meta: { title: '校园图书馆', icon: 'icon-tushuguan' },
    path: '/campus-library',
    name: 'CampusLibrary',
    component: 'Layouts',
    children: [{
      meta: { title: '图书库存' },
      path: 'book-inventory',
      name: 'BookInventory',
      component: lazy(() => import('@/views/CampusLibrary/BookInventory'))
    }, {
      meta: { title: '图书明细' },
      path: 'book-details',
      name: 'BookDetails',
      component: lazy(() => import('@/views/CampusLibrary/BookDetails'))
    }]
  }
]

export const constantRoutes: IRouter[] = [{
  path: '/login',
  name: 'login',
  meta: {
    title: '登录'
  },
  hidden: false,
  component: Login
}, {
  path: '/workbench',
  name: 'workbench',
  meta: { title: '首页' },
  hidden: false,
  component: lazy(() => import('@/views/workbench'))
}]

export default routes;

// 项目根目录 （初次进入默认地址）
export const root: string = '/workbench';
